﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;


namespace chihuopig.Service
{
    public abstract  class DBService
    {
        public  static SqlSugarClient Sqlclient = null;
        private static object obj = new object();

        public static SqlSugarClient getInstance(string ConfigurationStr,List<SlaveConnectionConfig> list)
        {
            
            if (Sqlclient==null)
            {
                lock (obj)
                {
                    return Sqlclient = new SqlSugarClient(new ConnectionConfig() { ConnectionString = ConfigurationStr, DbType = DbType.MySql, IsAutoCloseConnection = true,
                         SlaveConnectionConfigs = list
                    });
                }
            }
            return Sqlclient;
        }
    }
}
